<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>发布稿件 - ${site.name}</title>
[#include "../include/member_script.html"/]
<script type="text/javascript">
$.validator.methods.leafChannel = function(value, element, param) {
	var i = element.selectedIndex;
	return $(element.options[i]).attr("class")!="sel-disabled";
}
function format() {
    var body = document.getElementById("thebody").value;
    body = body.replace(/ |　/ig,"");
    body = body.replace(/\n/ig,"\n　　");
    body = body.replace("\n\n","");
    document.getElementById("thebody").value="　　"+body;
}
function format2() {
    var body = "\n"+document.getElementById("thebody").value;
    body = body.replace(/ |　/ig,"");
    body = body.replace(/\r\n/ig,"\n");
    body = body.replace(/\n\n/ig,"\n");
    body = body.replace(/\n\n/ig,"\n");
    body = body.replace(/\n\n/ig,"\n");
    body = body.replace(/\n\n/ig,"\n");
    body = body.replace(/\n/ig,"  \n");
    body = body.replace("\n\n","\n");
    document.getElementById("thebody").value=body;
}
function format3() {
        var body = "\n"+document.getElementById("thebody").value;
        body = body.replace(/ |　/ig,"");
        body = body.replace(/\r\n/ig,"\n");
        body = body.replace(/\n\n/ig,"\n");
        body = body.replace(/\n\n/ig,"\n");
        body = body.replace(/\n\n/ig,"\n");
        body = body.replace(/\n\n/ig,"\n");
        body = body.replace(/\n/ig,"\n\n");
        body = body.replace("\n\n","");
        document.getElementById("thebody").value=body;
}
$(function() {
	$("#jvForm").validate({
		rules: {
			channelId: {
				required: true,
				leafChannel: true
			}
		},
		messages:{
			channelId: {
				leafChannel: "请选择末级栏目"
			}
		}
	});
});
</script>
<style type="text/css">
.sel-disabled{background-color:#ccc}
.STYLE1 {color: #FF0000}
</style>
</head>

<body>
<div class="container">
[#include "../include/member_head.html"/]
<div class="main">
<div class="my_local">
<div class="location_cs">
您现在的位置：&nbsp;<a class='LinkPath' href='${base}/index.jsp'>网站首页</a>&nbsp;&raquo;&nbsp;<a class='LinkPath' href='${base}/member/index.jsp'>会员中心</a>&nbsp;&raquo;&nbsp;发布稿件
</div>
</div>
<div class="mrow box">
[#include "../include/member_navigate.html"/]
<div class="mc_center">
  <div><img src="/${res}/img/member/web_center_top.jpg" /></div>
  <div class="mc_center_bj"></div>
  <div><img src="/${res}/img/member/web_center_bottom.jpg" /></div>
</div>
<div class="mc_right">
   <div class="mc_top_bj box">
      <div class="page_tit">发布稿件</div>
   </div>
   <div class="mc_content">  
  [#if channelList?size gt 0]
    <form id="jvForm" action="contribute_save.jsp" method="post">
     <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#C8DCF0" style="margin:5px;">
       <tr>
         <td width="86" height="25" align="right" bgcolor="#FAF9FE">标题：</td>
         <td width="626" bgcolor="#FFFFFF"><input type="text" name="title" maxlength="150" class="required"/> <span class="STYLE1">*</span></td>
       </tr>
       <tr>
         <td height="25" align="right" bgcolor="#FAF9FE">作者：</td>
         <td bgcolor="#FFFFFF"><input type="text" name="author" maxlength="100" readonly="readonly" value="${user.username}"/></td>
       </tr>
       <tr>
         <td height="25" align="right" bgcolor="#FAF9FE">文学类型：</td>
         <td bgcolor="#FFFFFF">
		 <select name="channelId">
			[#if channelList?size gt 0]
			[#assign origDeep=channelList[0].deep+1/]
			[#list channelList as c]
			<option value="${c.id}"[#if c.child?size gt 0] class="sel-disabled"[/#if]>[#if c.deep gte origDeep][#list origDeep..c.deep as i]&nbsp;&nbsp;[/#list]>[/#if]${c.name}</option>
			[/#list]
			[/#if]
		</select>
         </td>
       </tr>
       <tr>
         <td height="25" align="right" bgcolor="#FAF9FE">投稿专题：</td>
         <td bgcolor="#FFFFFF">
		 <select name="topicId">
		 	<option value="">非专题投稿</option>
		 	[@cms_topic_list recommend='1' count='10']
			[#list tag_list as t]
			<option value="${t.id}">${t.name}</option>
			[/#list]
			[/@cms_topic_list]
		 </select>
         </td>
       </tr>
       <tr>
         <td height="25" align="right" bgcolor="#FAF9FE">文章自荐：</td>
         <td bgcolor="#FFFFFF"><textarea name="description" rows="4" cols="70" maxlength="255"/></textarea></td>
       </tr> 
       <tr>
         <td height="25" align="right" bgcolor="#FAF9FE">文章内容：</td>
         <td bgcolor="#FFFFFF"><textarea id="thebody" name="txt" rows="20" cols="70" maxlength="102400"/></textarea><br/>
         <input title="保留空行系统自动排版 " onclick="javascript:format()" type=button value="自动排版" />　
         <input title="自动段间空行自动排版" onclick="javascript:format3()" type=button value="添加空行" />　
         <input title="仅用于删除文章内多余空行及空格" onclick="javascript:format2()" type="button" value="清除空行" />
         </td>
       </tr>
       <tr>
         <td width="86" height="25" align="right" bgcolor="#FAF9FE">验证码：</td>
         <td width="626" bgcolor="#FFFFFF"><input type="text" name="captcha" maxlength="20" class="required"/> <span class="STYLE1">*</span>
         <img id="guestbookCaptcha" src="${base}/captcha.svl" onclick="this.src='${base}/captcha.svl?d='+new Date()"/></td>
       </tr>
       <tr>
         <td height="25" colspan="2" align="center" bgcolor="#FFFFFF">
		 <input type="hidden" name="nextUrl" value="contribute_list.jsp"/>
	     <input type="submit" value="提交" onclick="$('#jvForm').attr('action','contribute_save.jsp').removeAttr('target')"/> 
	     <input type="button" value="预览" onclick="$('#jvForm').attr('action','contribute_view.jsp').attr('target','_blank').submit();"/> 
	     <input type="reset" value="重置"/>
		 </td>
       </tr>
     </table>
	 </form>
	[#else]
	<div>系统不允许投稿，请联系管理员！</div>
	[/#if]
   </div>
</div>
</div>
</div>
[#include "../include/member_foot.html"/]
</div>
</body>
</html>